﻿layui.use(['form', 'upload'], function () {
    form = layui.form;
    upload = layui.upload;
    form.render();

    $.oss.uploadImg({
        type: UPLOAD_TYPE.AVATAR,
        callback: function (res) {
            let code = res.status;
            if (WEB_STATUS.SUCCESS === code) {
                $('#upload').attr('src', res.data.url);
                $("#avatar").val(res.data.url);
            } else {
                $.modal.msgError(res.msg)
            }
        }
    })

    /* 提交 */
    form.on('submit(saveBaseUser)', function (data) {
        let url = "/base/user";
        $.http.save(url, data.field);
    });

});
